import 'package:flutter/material.dart';
import 'widget_with_padding.dart';

class DemoRowAndColumn extends StatelessWidget {

  //线性布局
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: Text("DemoRowAndColumn"),),
        body: Column(
          //测试Row对齐方式，排除Column默认居中对齐的干扰
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Row(
              /**
               * layout
               */
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Text(" hello world "),
                Text(" I am Jack "),
              ],
            ),
            Row(
              /**
               * layout_width:wrapContain
               * gravity:center
               */
              //layout_width默认matchParent
              //mainAxisSize.min WRAP
              //mainAxisSize.max MATCH
              mainAxisSize: MainAxisSize.min,
              //mainAxisAlignment center
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Text(" hello world "),
                Text(" I am Jack "),
              ],
            ),
            WidgetWithPadding(Row(
//              mainAxisSize: MainAxisSize.max,
              /**
               * textDirection优先级很高，会影响mainAxisAlign方向
               */
              mainAxisAlignment: MainAxisAlignment.end,
              textDirection: TextDirection.rtl,
              children: <Widget>[
                Text(" hello world "),
                Text(" I am Jack "),
              ],
            ), 20, 20, 0, 20),
            Padding(
              padding: const EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 0.0),
              child: Row(
                crossAxisAlignment: CrossAxisAlignment.start,
                verticalDirection: VerticalDirection.up,
                children: <Widget>[
                  Text(" hello world ", style: TextStyle(fontSize: 30.0)),
                  Text(" I am Jack "),
                ],
              ),
            ),
          ],
        )
    );
  }
}